package com.cea.papyrus.core.treeeditpart;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.swt.graphics.Image;
import org.eclipse.uml2.uml.Element;

import com.cea.papyrus.core.PapyrusPlugin;
import com.cea.papyrus.core.editor.ModelManager;
import com.cea.papyrus.core.treeeditpart.pseudoelement.ProfileApplicationsGroup;

/**
 * Tree edit part for profile application groups
 */
public class GroupingProfileApplicationsTreeEditPart extends GroupingTreeEditPart {

	/** associated pseudo element */
	protected ProfileApplicationsGroup profileApplicationsGroup;
	
	
	/**
	 * Creates a new GroupingProfileApplicationsTreeEditPart
	 * @param profileApplicationsGroup the model for this edit part
	 * @param modelManager the model manager associated to the current editor
	 */
	public GroupingProfileApplicationsTreeEditPart(ProfileApplicationsGroup profileApplicationsGroup, ModelManager modelManager) {
		super(profileApplicationsGroup, modelManager);
		this.profileApplicationsGroup = profileApplicationsGroup;
	}
	
	/* (non-Javadoc)
	 * @see com.cea.papyrus.core.common.treeeditpart.CommonTreeEditPart#getText()
	 */
	@Override
	public String getText() {
		return "Applied Profiles ("+(profileApplicationsGroup.getPackage().getProfileApplications().size())+")";
	}

	/* (non-Javadoc)
	 * @see com.cea.papyrus.core.common.treeeditpart.CommonTreeEditPart#getImage()
	 */
	@Override
	public Image getImage() {
		return PapyrusPlugin.getImage(PapyrusPlugin.PAPYRUS_ICONS_16x16+"ProfileApplicationsGroup.gif");
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
	 */
	@Override
	protected List getModelChildren() {
		List<Element> contained = new ArrayList<Element>();
		contained.addAll(profileApplicationsGroup.getPackage().getProfileApplications());
		return contained;
	}
}
